The present invention relates generally to the creation of computer generated images for viewing on a display screen. In particular, the present invention relates to the shading of 2-dimensional and 3-dimensional computer generated images.
A primary motivation in the areas of shading and lighting in 3-dimensional computer graphics is to provide the viewer with a more realistic experience by accurately depicting the effects of light on surface variations. Lighting and shading in commercially available 3-dimensional graphics accelerators has traditionally been limited to a relatively simple vertex light variation scheme wherein light calculations are made for each polygon vertex and the resulting color values are interpolated throughout the drawn polygon surface. The limitations of Gouraud interpolation techniques such as these are well known and include inaccurate highlights and representation of only uniform surface variations at polygon vertices. See Gouraud, H., “Computer Display of Curved Surfaces,” IEEE Trans. Computers C-20 6:623-629 (1971). The primary motivation for using simplistic shading routines such as Gouraud interpolation is the cost of implementing lighting calculations.
In traditional graphics acceleration hardware, calculations are divided into per-vertex and per-pixel computations. General-purpose floating-point processors usually perform per-vertex computations while per-pixel computations are handled by dedicated fixed-point hardware. Since the throughput rate of per-pixel operations is of chief concern, it has been prohibitive to include complex operations per-pixel as they would either be detrimental to pixel throughput rate or require a substantial gate count to effectively parallelize the operations. Therefore, detailed per-pixel lighting algorithms must be leveraged with execution speed.
With the rapidly increasing transistor capacity of today's microprocessor as well as the advent of lower-cost per pixel lighting strategies such as those disclosed in U.S. patent application Ser. No. 09/222,036, entitled “Method and Apparatus for Providing Shading in a Graphic Display System” and filed in the name of David J. Collodi on Dec. 29, 1998, the entire disclosure of which is hereby incorporated by reference, per pixel computation can be realistically expanded to include more complex lighting operations such as bump-mapping and specularity modulation (dirt mapping).
The goal of most per-pixel lighting strategies is to generate the illusion of surfaces which are more complex than their defining geometry. Real world surfaces are imperfect, containing minor variations in height and composition. Therefore, to generate surfaces that simulate the real world, such surfaces must also contain minor variations in height and composition. Simulation of these variations is most aptly carried out on a per pixel basis. Bump mapping techniques simulate variations in surface orientation through map based per-pixel perturbation of surface normals. Such a technique is disclosed in the above-identified patent application.
Dirt mapping techniques are applied per-pixel to simulate variations of surface reflectivity. A dirt map ordinarily consists of a two-dimensional array of texels, each containing an n-bit number (usually 8 or less) representing a scalar reflectivity value between pre-defined extremes. For example, an 8-bit number can represent a reflectivity between 0 and 255 where 0 is defined as “extremely dull” and 255 is defined to be “highly reflective”. The dirt map value can be used to modulate the intensity of specular light at the pixel. The simplest method of achieving this is to multiply the specular intensity by the reflectivity value (taken as a 0-1 scalar). This approach is limited, however, in that the variation of reflective properties is not taken into account. Dull surfaces not only reflect less (specular) light than shiny surfaces; they also reflect it in a different pattern. The shape of the specular highlights produced by dull surfaces is not the same as those produced by glossy surfaces. In order to more accurately simulate the effects of light on variably reflective surfaces, the reflectivity value must also be able to modulate the specularity function as well as the light intensity, whereas a specularity function can be defined as any mathematical relating the intensity of reflected light to the particular angles of view, incidence, surface normal, and or reflection.
Although crude dirt mapping effects can be simulated with multi-pass rendering in today's realtime graphics accelerators, no commercial graphics accelerator provides dedicated logic to allow for the realistic variation of reflective properties per-pixel. Since most real world surfaces have variable reflectivity, the ability to accurately depict this characteristic of real surfaces in dynamic computer generated images would aid in the production of higher quality, more realistic images. Since there exists a significant market demand for realistic computer generated images, there also exists a demand for a realtime 3D graphics product capable of efficiently generating surfaces with variable reflectivity. Furthermore, there exists a demand for a low cost method of implementing said variable reflectivity, i.e., by allowing for a per-pixel variation of surface reflection characteristics and modulating the specular light per-pixel. The present invention details a method and system for the low cost generation of variably reflective surfaces for the purposes of realtime image generation.